package com.zhiyou.app.pojo.entity;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zhiyou.app.pojo.enums.OrderStatusEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 *
 * </p>
 *
 * @author jonathan.z
 * @since 2025-07-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("id_order")
public class OrderEntity extends BaseEntity {

    private static final long serialVersionUID = 1L;
    /**
     * 订单号
     */
    private String orderNum;

    /**
     * 微信交易号
     */
    private String wxTransactionId;

    /**
     * 订单发起人ID
     */
    private Integer userId;

    /**
     * 订单金额
     */
    private Integer orderAmount;

    private String orderDesc;

    private String orderParam;

    private OrderStatusEnum orderStatus;

    public <T> T getOrderParamList(Class<T> clazz) {
        if (orderParam != null) {
            return JSONUtil.toBean(orderParam, clazz, true);
        } else {
            return null;
        }
    }


}
